package com.edu.exam.enums.grading;

/**
 * 结果状态枚举
 */
public enum ResultStatus {
    VALID("VALID", "有效"),
    INVALID("INVALID", "无效"),
    EXPIRED("EXPIRED", "过期"),
    PARTIAL("PARTIAL", "部分有效"),
    PENDING("PENDING", "待验证"),
    VERIFIED("VERIFIED", "已验证"),
    ARCHIVED("ARCHIVED", "已归档");

    private final String code;
    private final String description;

    ResultStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static ResultStatus fromCode(String code) {
        for (ResultStatus status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return VALID; // 默认返回有效
    }
}